<template>
  <div class="news">
    <div
      v-for="(item, index) in item.data"
      :key="'news_index_' + index"
      class="news_panel"
    >
      <a :href="'pages/news-div?contentId=' + item.content.contentId">
        <div
          class="news_content"
          :class="item.content.aside.isTop ? 'istop' : ''"
        >
          {{ item.content.text }}
        </div>
      </a>
      <div class="news_aside">
        <div class="news_aside_top" v-if="item.content.aside.isTop">置顶</div>
        <div class="news_aside_left">
          <a :href="'pages/group-div?id=' + item.group.groupId">{{
            item.group.title
          }}</a>
        </div>
        <div class="news_aside_right">
          <a
            :href="
              'pages/comment-div?contentId=' +
                item.content.contentId +
                '&commentId=' +
                item.content.aside.comment.commentId
            "
          >
            评论{{ fixNumber(item.content.aside.comment.commentCount) }}
          </a>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "news",
  props: {
    item: {
      type: Object,
      default() {
        return {};
      },
    },
  },
  data() {
    return {};
  },
  methods: {
    fixNumber(t) {
      return this.$Plugins.fixNumber(t, 100);
    },
  },
};
</script>

<style lang="less">
@base: 23.44rem;
.news {
  text-align: left;
  padding: 0 (10 / @base);
  .news_panel {
    padding: (5 / @base) 0;
    .news_content {
      font-size: (14 / @base);
      padding: (5 / @base) 0;
      &.istop {
        font-weight: 700;
      }
    }
    .news_aside {
      font-size: (10 / @base);
      display: flex;
      color: #999999;
      .news_aside_top {
        color: red;
        margin: 0 (5 / @base) 0 0;
      }
      .news_aside_left {
      }
      .news_aside_right {
        margin: 0 0 0 (5 / @base);
      }
    }
  }
}
</style>
